<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="gly"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head>
<meta charset="GB18030">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/css/font-awesome.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/css/main.css">

</head>
<body style="margin-top: -50px">
	<div class="panel panel-default" style="margin-top: 0px">
		<div class="panel-heading">
			<h3 class="panel-title">
				<i class="glyphicon glyphicon-th"></i> 保养记录
			</h3>
		</div>
		
		<div class="panel-body">
			<!-- 查询start -->
			<form class="form-inline" role="form" style="float: left;" method="post" action="${pageContext.request.contextPath}/daily/upGetByCondition">
				<div class="form-group has-feedback">
					<div class="input-group">
						<div class="input-group-addon">查询依据</div>
						<select class="form-control has-success" name="uk_conditionBy">
							<option value="up_carlicense" ${sessionScope.uk_conditionBy=="up_carlicense"?"selected":""}>车牌号</option>
							<option value="up_type" ${sessionScope.uk_conditionBy=="up_type"?"selected":""}>保养类型</option>
						</select>
					</div>
				</div>
				<div class="form-group has-feedback">
					<div class="input-group">
						<div class="input-group-addon">查询条件</div>
						<input class="form-control has-success" type="text"
							placeholder="请输入查询条件，支持模糊查询" name="uk_condition" value="${sessionScope.uk_condition}">
					</div>
				</div>
				<button type="submit" class="btn btn-warning">
					<i class="glyphicon glyphicon-search"></i> 查询
				</button>
			</form>
			<!-- 查询end -->
			
<form action="" method="post">
			<button type="submit" class="btn btn-danger"
				style="float: right; margin-left: 10px;" id="sub1">
				<i class=" glyphicon glyphicon-remove"></i> 批量删除
			</button>
			<a class="btn btn-primary" style="float: right; margin-left: 10px;"
				href="" id="addupkeep" data-toggle="modal"
			data-target="#addModal"><span
				class="glyphicon glyphicon-plus"></span>增加</a> <br>
			<hr style="clear: both;">
			<div class="table-responsive">
				<table class="table  table-bordered">
					<thead>
						<tr>
							<th width="30">#</th>
							<th width="30"><input type="checkbox" id="selectAll"></th>
							<th>车牌号码</th>
							<th>保养类别</th>
							<th>保养时间</th>
							<th>保养金额</th>
							<th>保养单位</th>
							<th>本次保养里程</th>
							<th>下次保养时间</th>
							<th>下次保养里程</th>
							<th>操作人员</th>
							<th width="100">操作</th>
						</tr>
					</thead>
					<tbody id="tbody1">					
							<!-- ajax 拼接内容 -->
					<gly:forEach items="${pageInfo.list}" var="upkeep" varStatus="vs">
					<tr><td>${vs.count}</td>
					<td><input type='checkbox' value="${upkeep.upId}" name='cb'></td>
					<td>${upkeep.upCarlicense}</td>
					<td>${upkeep.upType}</td>
					<td><fmt:formatDate value="${upkeep.upTime}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
					<td>${upkeep.upAmount}</td>
					<td>${upkeep.upUnit}</td>
					<td>${upkeep.upThismileage}</td>
					<td><fmt:formatDate value="${upkeep.upNexttime}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
					
					<td>${upkeep.upNextmileage}</td>
					<td>${upkeep.upDriver}</td>
					
					<td><button type='button' class='btn btn-success btn-xs'><i class=' glyphicon glyphicon-list-alt'></i></button>
					<button type='button' class='btn btn-primary btn-xs' ><i class=' glyphicon glyphicon-pencil'></i></button>
					<button type='button' class='btn btn-danger btn-xs'><i class=' glyphicon glyphicon-remove'></i></button></td></tr>
					</gly:forEach>
					</tbody>

				</table>
			</div>
			</form>
			
			<!-- 增加模态框开始 -->
	<div class="modal fade" id="addModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">保养记录登记</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" role="form" id="add_upkeep_form">
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">车牌号码</label>
							<div class="col-sm-10">
								<select class="form-control" name="upCarlicense" id="upCarlicense1">
							
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养类别</label>
							<div class="col-sm-10">
								<select class="form-control" name="upType" id="upType1">
							
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养时间</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upTime1"
								value="" name="upTime" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养金额</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upAmount1"
									placeholder="请输入联系人电话" name="upAmount">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养单位</label>
							<div class="col-sm-10">
								<select class="form-control" name="upUnit" id="upUnit1">
							
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">本次保养里程</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upThismileage1"
								value="0"	 name="upThismileage">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养内容</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upContent1"
									placeholder="请输入备注" name="upContent">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">下次保养时间</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upNexttime1"
									placeholder="请输入备注" name="upNexttime" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">下次保养里程</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upNextmileage1"
									 name="upNextmileage" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">经办人</label>
							<div class="col-sm-10">
							<select class="form-control" name="upDriver" id="upDriver1">
							
								</select>							
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养备注</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upRemark1"
									placeholder="请输入备注" name="upRemark">
							</div>
						</div>
						
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" id="add_upkeep_btn" >保存</button>
				</div>
				
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->
	<!-- 增加结束 -->
			
			
	<!-- 修改模态框开始 -->
	<div class="modal fade" id="updModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">保养记录登记</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" role="form" id="upd_upkeep_form">
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">车牌号码</label>
							<div class="col-sm-10">
							<input type="hidden" name="upId" id="upId2" >
							<input type="text" class="form-control" id="upCarlicense2"
								 name="upCarlicense" readonly="readonly">
								
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养类别</label>
							<div class="col-sm-10">
								<select class="form-control" name="upType" id="upType2">
							
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养时间</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upTime2"
								 name="upTime" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养金额</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upAmount2"
									placeholder="请输入联系人电话" name="upAmount">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养单位</label>
							<div class="col-sm-10">
								<select class="form-control" name="upUnit" id="upUnit2">
							
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">本次保养里程</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upThismileage2"
								value="0"	 name="upThismileage">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养内容</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upContent2"
									placeholder="请输入内容" name="upContent">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">下次保养时间</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upNexttime2"
									 name="upNexttime" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">下次保养里程</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upNextmileage2"
									 name="upNextmileage" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">经办人</label>
							<div class="col-sm-10">
							<select class="form-control" name="upDriver" id="upDriver2">
							
								</select>							
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-2 control-label">保养备注</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="upRemark2"
									placeholder="请输入备注" name="upRemark">
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" id="upd_upkeep_btn" >保存</button>
				</div>
				
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->
	<!-- 修改结束 -->
	
	<!-- 展示模态框开始 -->
	<div class="modal fade" id="showModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">保养记录登记</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" role="form" id="show_upkeep_form">
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">车牌号码</label>
							<div class="col-sm-8" id="upCarlicense3" style="margin-top: 7px">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">保养类别</label>
							<div class="col-sm-8" id="upType3" style="margin-top: 7px">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">保养时间</label>
							<div class="col-sm-8" id="upTime3" style="margin-top: 7px">								
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">保养金额</label>
							<div class="col-sm-8" id="upAmount3" style="margin-top: 7px">							
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">保养单位</label>
							<div class="col-sm-8" id="upUnit3" style="margin-top: 7px">								
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">本次保养里程</label>
							<div class="col-sm-8" id="upThismileage3" style="margin-top: 7px">							
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">保养内容</label>
							<div class="col-sm-8" id="upContent3" style="margin-top: 7px">
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">下次保养时间</label>
							<div class="col-sm-8" id="upNexttime3" style="margin-top: 7px">								
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">下次保养里程</label>
							<div class="col-sm-8" id="upNextmileage3" style="margin-top: 7px">								
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">经办人</label>
							<div class="col-sm-8" id="upDriver3" style="margin-top: 7px">						
							</div>
						</div>
						<div class="form-group">
							<label for="dname" class="col-sm-4 control-label">保养备注</label>
							<div class="col-sm-8" id="upRemark3" style="margin-top: 7px">							
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>		
				</div>
				
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->
	<!-- 展示结束 -->
			<div class="row">
				<!--文字信息-->

				<div align="center">
					<ul class="pagination">

						<li><a href="${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=1">首页</a></li>

						<!--上一页-->
						<li><gly:if test="${pageInfo.hasPreviousPage}">
								<a
									href="${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${pageInfo.pageNum-1}"
									aria-label="Previous"> <span aria-hidden="true">«</span>
								</a>
							</gly:if></li>

						<!--循环遍历连续显示的页面，若是当前页就高亮显示，并且没有链接-->
						<gly:forEach items="${pageInfo.navigatepageNums}" var="page_num">
							<gly:if test="${page_num == pageInfo.pageNum}">
								<li class="active"><a href="#">${page_num}</a></li>
							</gly:if>
							<gly:if test="${page_num != pageInfo.pageNum}">
								<li><a
									href="${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${page_num}">${page_num}</a></li>
							</gly:if>
						</gly:forEach>

						<!--下一页-->
						<li><gly:if test="${pageInfo.hasNextPage}">
								<a
									href="${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${pageInfo.pageNum+1}"
									aria-label="Next"> <span aria-hidden="true">»</span>
								</a>
							</gly:if></li>

						<li><a
							href="${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${pageInfo.pages}">尾页</a></li>
					</ul>
				</div>
				<div align="center">当前第 ${pageInfo.pageNum} 页.总共
					${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录</div>
			</div>
		</div>

	</div>
	<script
		src="${pageContext.request.contextPath}/static/jquery/jquery-2.1.1.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/static/script/docs.min.js"></script>
	<script type="text/javascript">
	$(function(){
		//UseunitList();
		upd1();
		deleteone();
		Add();
		Add2();
		upd2();
		deletemany();
		show();
		
		$("#selectAll").change(function(){
			if($(this).prop('checked')==true){
				$('input[name="cb"]').each(function(){
				$(this).prop('checked',true);
			})
			}else{
				$('input[name="cb"]').each(function(){
					$(this).prop('checked',false);
				})
			}
			
		});			
	})
	
	function Add(){
		$("#addupkeep").click(function(){
			$.ajax({
				url:"upkeepadd1",
				type:"post",
				dataType:"json",
				async:true,
				success:function(data){
					var unitname	=data.unitNames;
					var uptype		  =data.upTypes;
					var license   =data.carlicenses;
					var drname    =data.drivernames;
					var str1="";
					var str2="";
					var str3="";
					var str4="";
					/* 车牌展示 */
					str1+="<option>选择类型</option>";
					for(var i=0;i<license.length;i++){
						str1+="<option name='license' value="+license[i]+">"+license[i]+"</option>";
					}
					$("#upCarlicense1").html(str1);
					/* 保养类型展示 */
					str2+="<option>选择类型</option>";
					for(var i=0;i<uptype.length;i++){
						str2+="<option value="+uptype[i]+">"+uptype[i]+"</option>";
					}
					$("#upType1").html(str2);
					/* 往来单位名展示 */
					str3+="<option>选择类型</option>";
					for(var i=0;i<unitname.length;i++){
						str3+="<option value="+unitname[i]+">"+unitname[i]+"</option>";
					}
					$("#upUnit1").html(str3);
					/* 经办人名展示 */
					str4+="<option>选择类型</option>";
					for(var i=0;i<drname.length;i++){
						str4+="<option value="+drname[i]+">"+drname[i]+"</option>";
					}
					$("#upDriver1").html(str4);
					changelicenses();
				}
			})
		})
	}
	function Add2(){
		$("#add_upkeep_btn").click(function(){
			$.ajax({
				url:"upkeepadd2",
				type:"post",
				data:$("#add_upkeep_form").serialize(),
				async:true,
				success:function(data){
					
					$("#addModal").modal('hide');
					window.location.href='${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${pageInfo.pageNum}';
				}
			})
		})
	}
	/* 修改1 */
	function upd1(){
		$("[class='btn btn-primary btn-xs']").click(function(){
			var i =$(this).parent().siblings().first().next().children().val();
			
			$.ajax({
				url:"upkeepupd1",
				type:"post",
				data:{"upId":i},
				async:true,
				dataType:"json",
				success:function(data){
					var unitname	=data.unitNames;
					var uptype		  =data.upTypes;
					var up1   			  =data.up1;
					var drname    =data.drivernames;
					var car1 			  =data.car;
					var str2="";
					var str3="";
					var str4="";
					/* 车牌展示 */
					$("#upId2").val(up1.upId);
					$("#upCarlicense2").val(up1.upCarlicense);
					
					/* 保养类型展示 */
					for(var i=0;i<uptype.length;i++){
						if(up1.upType==uptype[i]){
							str2+="<option selected>"+uptype[i]+"</option>";
						}else{
							str2+="<option >"+uptype[i]+"</option>";
						}						
					}
					$("#upType2").html(str2);
					
					/* 往来单位名展示 */
					for(var i=0;i<unitname.length;i++){
						if(up1.upUnit==unitname[i]){
							str3+="<option selected>"+unitname[i]+"</option>";
						}else{
							str3+="<option >"+unitname[i]+"</option>";
						}						
					}
					$("#upUnit2").html(str3);
					
					/* 经办人名展示 */
					for(var i=0;i<drname.length;i++){
						if(up1.upDriver==drname[i]){
							str4+="<option selected>"+drname[i]+"</option>";
						}else{
							str4+="<option >"+drname[i]+"</option>";
						}					
					}
					$("#upDriver2").html(str4);
					
					$("#upAmount2").val(up1.upAmount);
					$("#upThismileage2").val(up1.upThismileage);
					$("#upContent2").val(up1.upContent);
					$("#upRemark2").val(up1.upRemark);
					
					var mi=car1.carUpkeepmileage;
					$("#upThismileage2").change(function(){
						var nextmi =$("#upThismileage2").val()*1+mi*1;
						$("#upNextmileage2").val(nextmi);
					});
					var date1=new Date();
					var year=date1.getFullYear();
					var month=date1.getMonth()+1;
					var day=date1.getDate();
					var time =year+"-"+p(month)+"-"+p(day);
					$("#upTime2").val(time);
					var date2=new Date();
					date2.setMonth(month+car1.carUpkeeptime);
					var year2=date2.getFullYear();
					var month2=date2.getMonth();
					var day2=date2.getDate();
					var time2 =year2+"-"+p(month2)+"-"+p(day2);
					$("#upNexttime2").val(time2);
				}
			})
			$('#updModal').modal('show');
		})
	}
	/* 修改2 */
	function upd2(){
		$("#upd_upkeep_btn").click(function(){
			
			$.ajax({
				url:"upkeepupd2",
				type:"post",
				data:$("#upd_upkeep_form").serialize(),
				async:true,
				success:function(data){
					
					$("#updModal").modal('hide');
					window.location.href='${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${pageInfo.pageNum}';
				}
			})
		})
	}
	
	/* 删除一个 */
	function deleteone(){
		$("[class='btn btn-danger btn-xs']").click(function(){
			if (confirm("是否删除选中记录?")==false) {
				return ;
			}
			var i =$(this).parent().siblings().first().next().children().val();
			alert(i);
			$.ajax({
				url:"upkeepdeleteone",
				type:"post",
				data:{"upId":i},
				async:true,
				success:function(data){
									
					window.location.href='${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${pageInfo.pageNum}';
				}
			})
		})
	}
	/* 删除多个 */
	function deletemany(){
		$("#sub1").click(function(){
			
			var flag=false;
			$('input[name="cb"]').each(function(){
				if($(this).prop('checked')==true){
					flag=true;
				}
			})
			if (flag==false) {
				alert("请选择删除项目！");
			return false;
			}
			if (confirm("是否删除选中记录?")==false) {
				return;
			}
			var arr=[];
			$(":checkbox[name='cb']:checked").each(function(){
				arr.push($(this).val());
			})
			$.ajax({
				url:"upkeepdeletemany",
				type:"post",
				data:{"arr":arr.join(",")},
				async:true,
				success:function(data){
					alert("成功删除"+data+"条记录");					
					window.location.href='${pageContext.request.contextPath}/daily/upGetByCondition?uk_pn=${pageInfo.pageNum}';
				}
			})
		})
	}
	
	function p(s){
		return s<10? '0'+s:s;
	}
	function changelicenses(){
		$("#upCarlicense1").change(function(){
			$.ajax({
				url:"carlicenses",
				type:"post",
				async:true,
				data:{"licenses":$("[name='license']").val()},
				dataType:"json",
				success:function(resp){
					var mi =resp.carUpkeepmileage;
					
					$("#upThismileage1").change(function(){
						var nextmi =$("#upThismileage1").val()*1+mi*1;
						$("#upNextmileage1").val(nextmi);
					});
					var date1=new Date();
					var year=date1.getFullYear();
					var month=date1.getMonth()+1;
					var day=date1.getDate();
					var time =year+"-"+p(month)+"-"+p(day);
					$("#upTime1").val(time);
					var date2=new Date();
					date2.setMonth(month+resp.carUpkeeptime);
					var year2=date2.getFullYear();
					var month2=date2.getMonth();
					var day2=date2.getDate();
					var time2 =year2+"-"+p(month2)+"-"+p(day2);
					$("#upNexttime1").val(time2);			
				}
			})
		})
	}
	function show(){
		$("[class='btn btn-success btn-xs']").click(function(){
			var i =$(this).parent().siblings().first().next().children().val();
			
			$.ajax({
				url:"upkeepshow",
				type:"post",
				data:{"upId":i},
				async:true,
				dataType:"json",
				success:function(resp){
					var u =resp.up;
					var t1=resp.time;
					var t2=resp.ntime;
					$("#upCarlicense3").text(u.upCarlicense);
					$("#upType3").text(u.upType);
					
					$("#upTime3").text(t1);
					
					$("#upAmount3").text(u.upAmount);
					$("#upUnit3").text(u.upUnit);
					$("#upContent3").text(u.upContent);
					$("#upThismileage3").text(u.upThismileage);
										
					$("#upNexttime3").text(t2);
					
					$("#upNextmileage3").text(u.upNextmileage);
					$("#upRemark3").text(u.upRemark);
					$("#upDriver3").text(u.upDriver);
				}
			})
			$('#showModal').modal('show');
		})
	}
	
		</script>
</body>
</html>